﻿using System.Collections.Generic;
using Mysoft.Map.Extensions.DAL;

namespace Mysoft.Platform.OnlineLibrary.Repositories
{
	public class BatchLogRepository<T> where T : class, new()
	{
		public List<T> SelectAll(string user, int pageIndex, int pageSize, out int totalPage)
		{
			if( pageIndex <= 1 ) {
				pageIndex = 1;
			}
			int rowBegin = (pageIndex - 1) * pageSize + 1;
			int rowEnd = rowBegin + pageSize;
			totalPage = 0;

			return CPQuery.From("SELECT * FROM dbo.BatchLog WHERE Reader = @reader ORDER BY CreateDate DESC"
				, new { reader = user }).ToList<T>();
		}
	}
}